﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DemoForGit1
{   /// <summary>
    ///块状态 
    /// </summary>
    //enum Status
    //{
    //        IsBack,//牌的背面
    //       SuitStatus,//花色
    //      Number,//牌数
    //     Num//游戏中的点数

    //}
    
    /// <summary>
    /// 纸牌
    /// </summary>
    class Block
    {
        /// <summary>
        /// 状态
        /// </summary>
        public int Status { get; set; }

        public Point Point { get; set; }

        public bool IsBack { get; set; }
        public string Suitcase { get; set; }
        public string Number { get; set; }
        public double Num { get; set; }
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="point">矩阵坐标，注意它和物理坐标是反的</param>
        public Block(Point pt,bool isback,string color,string number,double point)
        {
            //初始状态为牌的背面
            Point = pt;
            IsBack = isback;
            Suitcase = color;
            Number = number;
            Num = point;

        }

        /// <summary>
        /// 定义牌面
        /// </summary>
        /// <param name="g"></param>
        /// <param name="rec"></param>
        public void Draw(Graphics g,Rectangle rec)
        {   
            if(IsBack)
            {
               g.DrawImage((Image)Properties.Resources.IsBack, rec);

            }
            else
            {
                try
                {
                    g.DrawImage((Image)Properties.Resources.ResourceManager.GetObject(Suitcase+Number), rec);
                }
                catch(System.Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                //牌的正面
            }
            
 }

